﻿using Autofac.Core;
using MediatR;
using SheepStorage.API.Application.Command.BuildingManagementCommand;
using SheepStorage.API.Application.Command.SheepWeightCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.Entity;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.BuildingManagementCommandHandler
{
    public class BuildingManagementFtHandler : IRequestHandler<BuildingManagementFtCommand, Results<BuildingManagement>>
    {

        private readonly IBuildingManagementService buildingManagementService;

        public BuildingManagementFtHandler(IBuildingManagementService buildingManagementService)
        {
            this.buildingManagementService = buildingManagementService;
        }


        public async Task<Results<BuildingManagement>> Handle(BuildingManagementFtCommand request, CancellationToken cancellationToken)
        {
            return Results<BuildingManagement>.DataResult(buildingManagementService.GetFtBuildingManagement(request.BuildingManagementId));
        }
    }
}
